package com.springcloud.eureka.client.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.netflix.eureka.EurekaClientConfigBean;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: yc
 */
@RestController
public class TestController {

    @Value("${server.port}")
    private String severPort;

    @Autowired
    EurekaClientConfigBean eurekaClientConfigBean;

    @RequestMapping("/hello/{param}")
    public String hello(@PathVariable("param")String param){

        return "hello word! port:"+ severPort + " you path :" + param;
    }

    @RequestMapping("sever")
    public String sever(){

        return eurekaClientConfigBean.getServiceUrl().toString();
    }
}
